<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JSONP解决跨域问题</title>
</head>
<body>
    
    <script>
        // JSONP 接口
        const url = 'https://www.imooc.com/api/http/jsonp?callback=handleResponse';
        // 手动加载 JSONP 接口，动态加载 JSONP 接口
        const script = document.createElement('script');
        script.src = url;
        document.body.appendChild(script);

        // 声明接口
        const handleResponse = (data)=>{
            console.log(data);
        }
    </script>
    <!-- <script src="https://www.imooc.com/api/http/jsonp?callback=handleResponse"></script> -->
</body>
</html>